
<script type="text/javascript" >
var typeMap={};
$(function() {
		 $.ajax({
				 async: false,
		         url: global_param.context_name+"/sys/getDictListByKey_code.do",
				 data : {
		    		key_code : "operation_type"
		    	 },
		    	 success: function(data){
		    		 $('#operation_type1').append("<option value='' selected='true'>请选择 </option>");
					for (var i = 0; i < data.length; i++) {
						typeMap[data[i].sys_dict_id]=data[i].value_meaning;
						 var selectStr="";
							 selectStr="<option value=" + data[i].sys_dict_id + ">" + data[i].value_meaning + "</option>"
					         $('#operation_type1').append(selectStr);
					}
				 }
		        });
	$('#operation_type1').val("");
	$('#oper_timestamp1').daterangepicker(globalUtil.initinfo);
	$('#oper_timestamp1').val("");
	$("#list_date").bootstrapTable({
		striped: true, 
	    url: global_param.context_name+'/sysLog/getSyslogList.do',
	    sidePagination : 'server',
	    cache: false,
	    pagination:true,
	    clickToSelect: true,
	    pageNumber:1,                       //初始化加载第一页，默认第一页
        pageSize: 10,                       //每页的记录行数（*）
        pageList: [10, 25, 50, 100],
	    queryParams: queryParams,
        formatNoMatches: function () {  //没有匹配的结果  
            return '无符合条件的记录';  
        },
        formatLoadingMessage: function(){
            return "请稍等，正在加载中。。。";
        },
	    columns: [
    	{
            field: '',
            title: '序号',
            switchable:false,
        	align:"center",
        	valign:"middle",
            formatter: function (value, row, index) {
                    return index+1;
            }
        },
        {
        	field : 'type',
            title : '操作类型',
	    	align:"center",
	    	valign:"middle",
	    	formatter: function (value, row, index) {
                return  typeMap[value]; 
            }
	    },
	    {
        	field : 'user_name',
            title : '操作人',
	    	align:"center",
	    	valign:"middle",
	    	formatter: function (value, row, index) {  
                return  value + row.user_code;  
            }
	    },
	    {
            field : 'oper_behavior',
            title : '操作内容',
	    	align:"center",
	    	valign:"middle"
        },
	    {
            field : 'oper_timestamp',
            title : '操作时间',
	    	align:"center",
	    	valign:"middle"
        }]
	});	   
    //回车查询
    
    $(window).keydown(function(event){
    	if (event.keyCode == 13) {
    		FindData();
        }
    });
});



function queryParams(params) {
    var param = {
    	type : $("#operation_type1").val(),
    	user_name : $("#user_name1").val(),
    	oper_behavior : $("#oper_behavior1").val(),
    	date_start: $('#oper_timestamp1').val().split(' - ')[0],
    	date_end: $('#oper_timestamp1').val().split(' - ')[1],
        pageindex : this.pageNumber,
        pageSize : this.pageSize
    }
    return param;
}


	//查询列表
function FindData() {
	$("#list_date").bootstrapTable("refresh",{});
}

function clearName(){
	$("#operation_type1").val("");
	$("#user_name1").val("");
	$("#oper_behavior1").val("");
	$("#oper_timestamp1").val("");
}

</script>

<section class="content-header">
	<h1 class="page-name">操作日志</h1>
	<ol class="breadcrumb">
	</ol>
</section>
<!-- Main content -->
<section class="content item">
	 <div class="container-fluid">
		<div class="row">
			<div class="box">
        		<div class="box-body">
        			<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">
		              	<div class="form-group">
		              		<label for="operation_type1">操作类型</label>
<!-- 		                <input type="text" class="form-control"  id="operation_type1" style="width: 100%;"> -->
		                	<select class='form-control' id='operation_type1' name='operation_type1'></select>
      					</div>
		              </div>
		        	<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">
		              <div class="form-group">
		              	<label for="user_name1">操作人</label>
		                <input type="text" class="form-control"  id="user_name1" style="width: 100%;" placeholder="请输入操作人" >
		              </div>
		            </div>
		            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">
		            	<div class="form-group">
			                <label for="oper_behavior1">操作内容</label>
							<input type="text" class="form-control"  id="oper_behavior1" style="width: 100%;" placeholder="请输入操作内容" >
		                </div>
		            </div>
		            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">
		              <div class="form-group">
		                  <label for="oper_timestamp1">操作日期</label>
						  <input type="text" class="form-control"  id="oper_timestamp1" style="width: 100%;" placeholder="请输入操作日期" >
		              </div>
		            </div>	
		            <div class="col-lg-3 col-md-3 col-sm-5 col-xs-12">
		            	<div class="form-group">
		             	   <label>&nbsp;</label>
		             	   <div class="row">
							   <div class="col-xs-6">
								   <button type="button" class="btn btn-block btn-primary" onclick="FindData()">查询</button>
							   </div>
							   <div class="col-xs-6">
								   <button type="button" class="btn btn-block btn-default" onclick="clearName()">清空</button>
							   </div>
						   </div>
					    </div>
		            </div>
		    	</div>
		   </div>
		</div>
    </div>
    
	<div class="row">
        <div class="col-xs-12">
            <div class="box box-primary">
              <div class="box-header">
                 <h3 class="box-title">数据列表</h3>
              </div>
              <div class="box-body">
				<table id="list_date" data-toolbar="#toolZoom">
				</table>
			  </div>
            </div>
         </div>
     </div>
</section>
